package server;

import java.io.*;


public class ObjectHandler {
	String fileName;
	
	FileOutputStream fos;
	ObjectOutputStream oos;
	FileInputStream fis;
	ObjectInputStream ois;
	
	
	public ObjectHandler(String fileName) {
		this.fileName = fileName;
	}
	
	public Object readObject() throws Exception {
		fis = new FileInputStream(fileName);
		ois = new ObjectInputStream(fis);
		return ois.readObject();
	}

	public void writeObject(Object o) throws Exception {
		fos = new FileOutputStream(fileName);
		oos = new ObjectOutputStream(fos);
		oos.writeObject(o);
		oos.close();
	}
}
